package com.um2.simplexe.client.plugin.console;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;

import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;

import com.um2.simplexe.client.ui.exec.ToutesLesMethodesClient;
import com.um2.simplexe.client.ui.util.controleUI.chargeur.menu.ControleurDeMenu;

public class PluginConsole implements ControleurDeMenu  {
	private ToutesLesMethodesClient tlmd = null ;
	private Console console = new Console();
	
	public Vector<JMenu> ajouterALaMenuBar() {
		JMenu jm = new JMenu("Console") ;
		JMenuItem jmi1 = new JMenuItem("nouvelle console") ;
		jm.add(jmi1) ;
		
		JMenuItem jmi2 = new JMenuItem("fermer la console") ;
		jm.add(jmi2) ;
		
		jmi1.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent arg0) {
				tlmd.ajouterALaZone3("console", new JPanel()) ;
				
			}}) ;
		
		jmi2.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent arg0) {
						tlmd.retirerALaZone3(tlmd.getZone3Indice()) ;
			}}) ;
		
		Vector<JMenu> v = new Vector<JMenu> () ;
		v.add(jm) ;
		
		return v;
	}

	public JPanel getInfosPlugin() {
		return null;
	}

	public String getNomPlugin() {
		return "plugin creation de console";
	}

	public void setListeFonctionsDisponibles(ToutesLesMethodesClient arg0) {
		tlmd = arg0 ;
		tlmd.ajouterALaZone2("Console", console);
	}
}
